<template>
	<view class="presc-item-wrap" @click="onClick">
		<view class="main2">
			<view class="mod2" v-if="data.recipeType == 0">西药处方</view>
			<view class="mod3" v-if="data.recipeType == 1">中药处方</view>
			<view class="word6">共{{ data.recipeDetailDTO.length }}种药品</view>
			<image src="http://k8s.vendingtech.vip/images/next_icon@2x.png" class="label2"></image>
		</view>
		<view class="outer4" v-if="type==3">
			<image :src="data.picture" class="mod4"></image>
			<view class="word4">{{ data.doctorName }}</view>
			<view class="word5">{{ data.departmentName }}</view>
		</view>
		<view class="main3" v-if="type==1">{{data.patient.patientName}} {{rangeSex[data.patient.sex].text}} {{data.patient.age}}岁</view>
		<view class="main3">诊断：{{ data.diagnose }}</view>
		<view class="main4">
			<view class="word8" v-for="(item, index) in data.recipeDetailDTO" :key="index">
				{{ item.commodity.name }}*{{ item.commodityNum }}{{ item.commodity.westernDrugVO.unit }}
			</view>
		</view>
		<view class="main5" v-if="type==0">
			<view class="bd bd-gray" @click.stop="onClickOne">删除</view>
			<view class="bd bd-purple" v-if="selectModel" @click.stop="onClickTwo">{{ btnText }}</view>
		</view>
		<view class="main5" v-if="type==1">
			<view class="bd bd-purple" v-if="data.status==0" @click.stop="onClickOne">审核处方</view>
			<view class="txt txt-green" v-if="data.status==1" >审核通过</view>
			<view class="txt text-red" v-if="data.status==4" >审核不通过</view>
		</view>
		<view class="main5" v-if="type==3">
			<view class="txt txt-purple" v-if="data.status==0" >处方审核中</view>
			<view class="bd bd-green" v-if="data.status==1" @click.stop="onClickOne">去购药</view>
			<view class="txt text-red" v-if="data.status==4" >审核不通过</view>
			<view class="txt txt-gray" v-if="data.status==2" >已购买</view>
			<view class="txt txt-gray" v-if="data.status==3" >已失效</view>
		</view>
	</view>
</template>

<script>
export default {
	props: {
		type: {
			type: String | Number,
			defaul: 0
		},
		data: {
			type: Object,
			default() {
				return {};
			}
		},
		btnText: {
			type: String,
			default: '使用处方'
		},
		selectModel: {
			type: Boolean,
			default: false
		}
	},
	data() {
		return {};
	},
	onLoad(option) {},
	onShow() {},
	methods: {
		onClick() {
			this.$emit('click');
		},
		onClickOne() {
			this.$emit('clickOne');
		},
		onClickTwo() {
			this.$emit('clickTwo');
		}
	}
};
</script>

<style lang="less">
.presc-item-wrap {
	border-radius: 8rpx;
	background-color: rgba(248, 248, 248, 1);
	margin-bottom: 10rpx;
	width: 626rpx;
	padding: 20rpx;
	box-sizing: border-box;
	.main2 {
		display: flex;
		align-items: center;
		margin-bottom: 20rpx;
		.mod2 {
			height: 30rpx;
			border-radius: 4rpx;
			border: 1rpx solid rgba(35, 199, 156, 1);
			width: 100rpx;
			justify-content: center;
			align-items: center;
			display: flex;
			flex-direction: column;
			background: rgba(247, 255, 253, 1);
			font-size: 20rpx;
			color: rgba(35, 199, 156, 1);
			font-family: PingFangSC-Regular;
		}
		.mod3 {
			height: 30rpx;
			border-radius: 4rpx;
			border: 1rpx solid #6E99C7;
			width: 100rpx;
			justify-content: center;
			align-items: center;
			display: flex;
			flex-direction: column;
			background: #f9f7ff;
			font-size: 20rpx;
			color: #6E99C7;
			font-family: PingFangSC-Regular;
		}
		.word6 {
			color: rgba(153, 153, 153, 1);
			font-size: 20rpx;
			font-family: PingFangSC-Regular;
			margin-left: auto;
		}
		.label2 {
			width: 17rpx;
			height: 17rpx;
			margin-left: 9rpx;
		}
	}
	.outer4 {
		display: flex;
		align-items: center;
		margin-bottom: 20rpx;
		.mod4 {
			height: 60rpx;
			border-radius: 50%;
			width: 60rpx;
			display: flex;
			flex-direction: column;
		}
		.word4 {
			color: rgba(51, 51, 51, 1);
			font-size: 28rpx;
			font-family: PingFangSC-Medium;
			margin-left: 16rpx;
		}
		.word5 {
			color: rgba(153, 153, 153, 1);
			font-size: 24rpx;
			font-family: PingFangSC-Regular;
			margin-left: 28rpx;
		}
	}
	.main3 {
		margin-bottom: 8rpx;
		color: rgba(51, 51, 51, 1);
		font-size: 28rpx;
		font-family: PingFangSC-Regular;
	}
	.main4 {
		margin-top: 12rpx;
		.word8 {
			color: rgba(153, 153, 153, 1);
			font-size: 24rpx;
			font-family: PingFangSC-Regular;
			margin-bottom: 8rpx;
		}
	}
	.main5 {
		flex-direction: row;
		display: flex;
		justify-content: flex-end;
		align-items: center;
		.bd {
			height: 40rpx;
			border-radius: 20rpx;
			
			margin-right: 20rpx;
			padding: 0rpx 20rpx;
			justify-content: center;
			align-items: center;
			display: flex;
			flex-direction: column;
			font-size: 24rpx;
			font-family: PingFangSC-Medium;
		}
		.bd-gray{
			border: 1rpx solid rgba(153, 153, 153, 1);
			background-color: rgba(255, 255, 255, 1);
			color: rgba(153, 153, 153, 1);
		}
		.bd-purple{
			border: 1rpx solid #6E99C7;
			background-color: rgba(249, 247, 255, 1);
			color: #6E99C7;
		}
		.bd-green{
			border: 1rpx solid #23C79C;
			background-color: #F7FFFD;
			color: #23C79C;
		}
		.txt{
			margin-left: auto;
			font-size: 24rpx;
			font-family: PingFangSC-Medium, PingFang SC;
			font-weight: 600;
		}
		.txt-purple {
			
			color: #6E99C7;
		}
		.txt-green {
			color: #23C79C;
		}
		.txt-gray {
			color: rgba(153, 153, 153, 1);
		}
		.text-red {
			
			color: #FF4141;
		}
	}
}
</style>
